<template>
    <div id="OrdersTitle">
        <v-details :inputConfig="inputConfig" :detailData="inputData" :rules="rules" @pop="setData"
                   ref="input"></v-details>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {
                rules: {
                    cust_code: [
                        {required: true, trigger: 'blur'},
                    ],
                    report_code: [
                        {required: true, trigger: 'blur'},
                    ],
                    send_flag: [
                        {required: true, trigger: 'blur'},
                    ],
                },
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "table",
                            label: this.$t('bill.customer'),
                            props: "cust_code",
                            tableConfig: [
                                {
                                    label: this.$t('bill.customer'),
                                    prop: "cust_code",
                                    input: "input",
                                },
                                {
                                    label: this.$t('common.desc'),
                                    prop: "cust_desc",
                                    input: "input",
                                },
                            ],
                            url: `/queryRpt/1/?/${this.$store.state.wms}`
                        },
                        {
                            type: "select",
                            label: this.$t('bill.invoice'),
                            props: "report_code",
                            options: this.getOptions("getSelectCode/REPORT_CODE/REPORT_NAME/BIC_CODE_REPORT/language='zh'")
                        },
                        {
                            type: "textarea",
                            label: "报告URL",
                            props: "report_url",
                        }
                    ],
                    [
                        {
                            type: "select",
                            label: this.$t('bill.invoiceType'),
                            props: "invoice_type",
                            options: this.getOptions("getSelectCode/INVOICE_TYPE/INV_TYPE_DESC/BIC_CODE_INVTYPE/language='zh'")
                        },
                        {
                            type: "select",
                            label: "仓库ID",
                            props: "facility_id",
                            options: this.getOptions("getSelectCode/FACILITY_ID/NAME/BIC_FACILITY/1=1")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.billTo'),
                            props: "bill_to",
                            options: this.getOptions("getSelectCode/BILL_TO_CUST/NAME/BIC_BILL_TO/1=1")
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: "发送标志",
                            props: "send_flag",
                            options: this.getOptions("codelkup/ISCLOSE")
                        },
                        {
                            type: "select",
                            label: "发送方法",
                            props: "send_method",
                            options: this.getOptions("codelkup/SENDMETH")
                        },
                        {
                            type: "input",
                            label: "发送列表",
                            props: "send_list",
                        },
                    ]
                ]
            }
        },
        methods: {
            setData(data, id, close, listId) {
                this.inputData.cust_code = data.cust_code;
                close(false);
            }
        },
        mounted() {
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
